package com.lin.linchatgpt.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.lin.linchatgpt.service.MessageService;
import com.lin.linchatgpt.utils.LinResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * Copyright(C),2022年-2022,霖霖
 *
 * @author 霖霖
 * @version 1.0
 * @date 2023/6/15 7:25
 * @Description 聊天
 */
@RestController
@RequestMapping("lin_chat/message")
@SaCheckLogin
public class MessageController {
    @Resource
    private MessageService messageService;
    /**
     * @description 根据主题id查询聊天记录列表
     * @author 霖霖
     * @date 2023/6/15 7:27
     * @params  [java.lang.String]
     * @return  com.lin.linchatgpt.utils.LinResult
     */
    @GetMapping("messages/{subjectId}")
    public LinResult getMessages(@PathVariable("subjectId") String subjectId) {
        return LinResult.success().data("list", messageService.getMessages(subjectId));
    }

}
